﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DataGridSelectedItems.Models;

namespace DataGridSelectedItems
{
    public class MainWindowViewModel : PropertyChangedBase
    {
        public MainWindowViewModel()
        {
            this.Persons = new ObservableCollection<Person>();

            for (int i = 0; i < 20; i++)
            {
                this.Persons.Add(new Person(){Id = Guid.NewGuid(),Number = $"N00{i}",Name = $"孙{i}海"});
            }
            this.SelectedPersons = new ObservableCollection<Person>(this.Persons.Take(5));
        }
        #region #属性

        private ObservableCollection<Person> _persons;

        public ObservableCollection<Person> Persons
        {
            get { return this._persons; }
            set
            {
                this._persons = value;
                base.NotifyOfPropertyChange();
            }
        }

        private IList _selectedPersons;

        public IList SelectedPersons
        {
            get { return this._selectedPersons; }
            set
            {
                this._selectedPersons = value;
                base.NotifyOfPropertyChange();
            }
        } 
        #endregion
    }
}
